import React, {Component} from 'react'
class SelectComponent extends Component {
  constructor(props) {
    super(props);
    this.state = {
      value: '被选中的select',
      options: [
        {
          name: '小明',
          value: 90
        }, {
          name: '小红',
          value: 91
        }, {
          name: '小刚',
          value: 78
        }
      ]
    }
    this.handleChange = this
      .handleChange
      .bind(this);
  }

  handleChange(event) {
    console.log('我选择的' + event.target.value);
  }

  render() {
    return (
      <div>
        <select name="" id="" onChange={(event) => (this.handleChange(event))}>
          {this
            .state
            .options
            .map((option, index) => (
              <option key={index} value={option.value}>{option.name}</option>
            ))}
        </select>
      </div>
    )
  }
}

export default SelectComponent